/**
 * 
 */
package com.logistics.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.logistics.ExpressCompany;
import com.logistics.ExpressCompanyQueryParam;
import com.logistics.admin.AdminGenericBaseAction;
import com.logistics.service.ExpressCompanyService;

/**
 * @author hzz
 *
 * 2014年5月12日
 */

@Component("expressCompanyAdminAction")
@Scope("prototype")
public class ExpressCompanyAdminAction extends AdminGenericBaseAction<ExpressCompany, ExpressCompanyService> {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1404096153842099871L;
	
	private ExpressCompanyService service;
	
	@Autowired
	public void setService(ExpressCompanyService service) {
		this.service = service;
	}

	@Override
	public ExpressCompanyService getService() {
		return service;
	}

	private ExpressCompany company;
	
	public ExpressCompany getCompany() {
		return company;
	}

	public void setCompany(ExpressCompany company) {
		this.company = company;
	}

	private List<ExpressCompany> companies;
	
	public List<ExpressCompany> getCompanies() {
		return companies;
	}

	public void setCompanies(List<ExpressCompany> companies) {
		this.companies = companies;
	}
	
	private ExpressCompanyQueryParam param;

	public ExpressCompanyQueryParam getParam() {
		return param;
	}

	public void setParam(ExpressCompanyQueryParam param) {
		this.param = param;
	}

	public String list() {
		if (param == null) {
			param = new ExpressCompanyQueryParam();
		}
		
		param.setPaging(getPaging());
		
		companies = service.query(param);
		
		return LIST;
	}
	
	@Override
	protected ExpressCompany initEntityForAdd() {
		return company;
	}

	@Override
	protected void initEditForm() {
		company = service.getById(getId());
	}
	
}
